package tech.yangzhijie.basic.java05;

public class Java06 {

    public static void main(String[] args) {

        int[] delete = delete(new int[]{0,1,2,3,4,5,6,7,8,9,10});
        for (int i = 0; i < delete.length; i++) {
            int i1 = delete[i];
            System.out.print(i1+"\t");
        }
    }

    private static int[] delete(int[] arr){
        int length = 0;
        for (int i = 0; i < arr.length; i++) {
            if(i%2==0&&arr[i]%2==0){
                length++;
            }
        }
        int[] b = new int[length];
        for (int i = 0,j=0; i < arr.length; i++) {
            if(i%2==0&&arr[i]%2==0){
                b[j++] = arr[i];
            }
        }
        return b;
    }
}
